import React from 'react'
import { Switch, Route, HashRouter as Router } from 'react-router-dom'
import routes from './router'
import HeaderTop from '../pages/Layout/HeaderTop'
import Navbar from '../pages/Layout/Navbar'

const Root = () => {
  const getRouts = () => {
    return routes.map(item => {
      return <Route exact path={item.path} component={item.component}></Route>
    })
  }

  return (
    <>
      <HeaderTop />
      <Navbar />
      <Router>
        <Switch>{getRouts()}</Switch>
      </Router>
    </>
  )
}

export default Root
